POV-Ray : Newsgroups : povray.programming : Improved intersection routine for CSG-Intersection objects : Re: Improved intersection routine for CSG-Intersection objects Server Time
6 Oct 2024 15:18:35 EDT (-0400)
  Re: Improved intersection routine for CSG-Intersection objects  
From: Wolfgang Wieser
Date: 14 Dec 2003 17:52:57
Message: <3fdce9c8@news.povray.org>
Thorsten Froehlich wrote:

> In article <3fdcbe02@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>
> wrote:
> 
>> Pointers are the most useful thing in C and you cannot get around
>> them in C++ if you want to keep fast performance.
>> All that guided stuff I've heared yet is both slow & fat.
> 
> I don't know which implementation you are refering to, but neither the two
> leading compilers for Windows nor the two leading compilers for Mac OS
> have
> such a problem.  In fact, it is really hard to make auto_ptr use slow
> anywhere if the compiler supports at least the most trivial of
> optimisations...
> 
First of all, the copy constructor and assignment operators will 
introduce overhead:

tempate<classT> 
 auto_ptr<T>& auto_ptr<T>::operator=(auto_ptr<T>& rhs) 
 { 
   if (this != &rhs) 
   { 
     delete pointer;   // <-- if(pointer) { destruct & free }
     pointer = rhs.pointer; 
     rhs.pointer = 0; 
   } 
   return *this; 
 } 

(compared to a simple "copy an integer" which is done at normal 
pointer assignment)

And then, auto_ptr may have some limits in usability because of the 
strict ownership design. Using smart_ptr instead will introduce 
some more overhead. 

Wolfgang


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.